package com.java.service.impl;

import com.java.entity.Receivinginfo;
import com.java.dao.ReceivinginfoDao;
import com.java.service.ReceivinginfoService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * (Receivinginfo)表服务实现类
 *
 * @author makejava
 * @since 2021-01-20 18:54:57
 */
@Service("receivinginfoService")
public class ReceivinginfoServiceImpl implements ReceivinginfoService {
    @Resource
    private ReceivinginfoDao receivinginfoDao;

    /**
     * 通过ID查询单条数据
     *
     * @param rId 主键
     * @return 实例对象
     */
    @Override
    public Receivinginfo queryById(Integer rId) {
        return this.receivinginfoDao.queryById(rId);
    }

    /**
     * 查询多条数据
     *
     * @param offset 查询起始位置
     * @param limit 查询条数
     * @return 对象列表
     */
    @Override
    public List<Receivinginfo> queryAllByLimit(int offset, int limit) {
        return this.receivinginfoDao.queryAllByLimit(offset, limit);
    }

    /**
     * 新增数据
     *
     * @param receivinginfo 实例对象
     * @return 实例对象
     */
    @Override
    public Receivinginfo insert(Receivinginfo receivinginfo) {
        this.receivinginfoDao.insert(receivinginfo);
        return receivinginfo;
    }

    /**
     * 修改数据
     *
     * @param receivinginfo 实例对象
     * @return 实例对象
     */
    @Override
    public Receivinginfo update(Receivinginfo receivinginfo) {
        this.receivinginfoDao.update(receivinginfo);
        return this.queryById(receivinginfo.getRId());
    }

    /**
     * 通过主键删除数据
     *
     * @param rId 主键
     * @return 是否成功
     */
    @Override
    public boolean deleteById(Integer rId) {
        return this.receivinginfoDao.deleteById(rId) > 0;
    }
}